<%--
  Created by IntelliJ IDEA.
  User: Zhao
  Date: 2017/2/21
  Time: 23:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建模块</title>
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function () {
        $("#type").val('${module.type}')
        $(".edit-module-submit").bind('click', function () {
            var id = $('.edit-module-table [name="id"]').val();
            var name = $('.edit-module-table [name="name"]').val();
            var type = $('.edit-module-table [name="type"]').val();
            $.ajax({
                url: '/admin/module/editModule.do',
                type: 'POST',
                //将formData对象作为参数进行上传
                data: {
                    'id': id,
                    'name': name,
                    'type': type,
                },
                success: function (data) {
                    if (data == 'success') {
                        $.messager.alert('成功', '模块编辑成功');
                        $('#moduleDg').datagrid('reload');
                        return;
                    }
                    $.messager.alert('警告', '模块编辑失败');
                },
                error: function () {
                    $.messager.alert('警告', '模块编辑失败');
                }
            });
        });
    })
</script>

<table class="table edit-module-table">
    <tr>
        <td>模块名称</td>
        <td><input type="text" name="name" value="${module.name}"></td>
    </tr>
    <tr>
        <td>模块类型</td>
        <td>
            <select id="type" name="type">
                <option value ="0" selected="true">普通类型</option>
                <option value ="1">人物类型</option>
            </select>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <a class="easyui-linkbutton edit-module-submit" data-options="iconCls:'icon-ok'">提交</a>
        </td>
    </tr>
    <input type="hidden" name="id" value="${module.id}" >
</table>
</body>
</html>